import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.builtins.IntArraySerializer
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.json.Json

fun <T> String.jsonToT(deserializer: DeserializationStrategy<T>): T {
    return Json.decodeFromString(deserializer, this)
}

fun String.jsonListIntArray(): List<IntArray> {
    return jsonToT(ListSerializer(IntArraySerializer()))
}

fun String.jsonArrayIntArray(): Array<IntArray> {
    return jsonListIntArray().toTypedArray()
}